﻿using System;
using UnityEngine;
namespace LitTools
{
    /// <summary>
    /// 生命周期观察
    /// </summary>
    [DisallowMultipleComponent]
    public class LifeTimeObserver : MonoBehaviour
    {
        public Action OnAwakeAct;
        public Action OnEnableAct;
        public Action OnStartAct;
        public Action OnFixedUpdateAct;
        public Action OnUpdateAct;
        public Action OnLateUpdateAct;
        public Action OnDisableAct;
        public Action OnDestroyAct;
        private void Awake()
        {
            OnAwakeAct?.Invoke();
        }
        private void OnEnable()
        {
            OnEnableAct?.Invoke();
        }
        private void Start()
        {
            OnStartAct?.Invoke();
        }
        private void FixedUpdate()
        {
            OnFixedUpdateAct?.Invoke();
        }
        private void Update()
        {
            OnUpdateAct?.Invoke();
        }
        private void LateUpdate()
        {
            OnLateUpdateAct?.Invoke();
        }
        private void OnDisable()
        {
            OnDisableAct?.Invoke();
        }
        private void OnDestroy()
        {
            OnDestroyAct?.Invoke();
        }
    }
}